//货柜管理-货柜列表-配置文件
App.util.ns('Admin.Cabinet.Cabinet');
Admin.Cabinet.Cabinet.Conf = {
    columns: [
        {name: '名称', value: 'name'},
        {name: '店面', width: '200px', value: function(item){
            return item.storefront ? item.storefront.name : '';
        }},
        {name: '型号', width: '150px', value: function(item){
            return item.type ? item.type.name : '';
        }},
        {name: '格子数', width: '100px', value: function(item){
            var link = $('<a href=""></a>')
            return item.type ? item.type.cells : '';
        }},
        {name: '地址编号', width: '120px',value: 'code'},
        {name: '是否交押金', width: '80px',value: function(item){
            switch (item.is_deposit+'') {
                case '0':
                    return '否';
                case '1':
                    return '是';
            }
        }},
        {name: '状态', width: '80px',value: function(item){
            switch (item.status+'') {
                case '0':
                    return '未部署';
                case '1':
                    return '已部署';
            }
        }},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        {type: 'input', name: 'name', title: '名称', required: true, maxLength: 40, rule: {
            type: 'str',
            range: [1, 40]
        }},
        {type: 'chosen', name: 'storefront_id', title: '店铺',required: true,
            items: App.models.get('storefront-all'),
            item_key: 'id',
            item_name: 'name',
            value_key: 'id',
            rule:{
                type: 'num',
                range: [1, 10]
            }
        },
        {type: 'chosen', name: 'type_id', title: '型号', required: true,
            items: App.models.get('type-all'),
            item_key: 'id',
            item_name: 'name',
            value_key: 'id',
            rule:{
                type: 'num',
                range: [1, 10]
            }
        },
        {type: 'input', name: 'code', title: '地址编号', rule: {
            type: 'str',
            range: [0, 100]
        }},
        {type: 'textarea', name: 'introduction', title: '简介', maxLength: 200,
            rule: {
            type: 'str',
            range: [0, 200]
        }}
    ]
};